<?php
class ReturnIndexAction extends AdminAction
{
	public function __construct()
	{
		parent::__construct();
		$this->layout = 'default';
	}

	public function execute()
	{
		$page	= $this->getPage();
		$pageSize = 20;
		$num = $pageSize;
		$start = ($page-1) * $pageSize;
		
		$con			= array();
		$status			= $this->context->get('status');
		if(is_numeric($status))
		{
			$con['status']	= $status;
		}
		$returnService		= new ReturnService();
		$this->data['return'] = $returnService->query($con, 'updated DESC', $start, $num);
		
		$count 		= $this->data['return']['count'];
		$baseUrl 	= C('LtUrl')->generate('Return', 'Index', array('p' => ':page','status' => $status));
		
		$pagination = new LtPagination($pageSize);
		$this->data['pages'] = $pagination->pager($page, $count, $baseUrl);
		
		$this->data['menu']		= 'return';
		$this->data['submenu']	= 'index';
		$this->data['status']	= $status;
	}
}
